﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Interactivity;
using System.Windows.Media.Imaging;

namespace Phone7ActionPack.Actions
{
    /*
    public class ChoosePictureAction : TargetedTriggerAction<FrameworkElement>
    {
        public string TargetProperty
        {
            get { return (string)GetValue(TargetPropertyProperty); }
            set { SetValue(TargetPropertyProperty, value); }
        }

        // Using a DependencyProperty as the backing store for TargetProperty.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TargetPropertyProperty =
            DependencyProperty.Register("TargetProperty", typeof(string), typeof(ChoosePhoneNumberAction), new PropertyMetadata("Text"));

        Microsoft.Phone.Tasks.PhotoChooserTask task;
        public ChoosePictureAction()
        {
            Image i = new Image();
            

            Microsoft.Phone.Tasks.ChooserListener.ChooserCompleted += new EventHandler(ChooserListener_ChooserCompleted);
            task = new Microsoft.Phone.Tasks.PhotoChooserTask();
        }

        void ChooserListener_ChooserCompleted(object sender, EventArgs e)
        {
            var results = e as Microsoft.Phone.Tasks.TaskEventArgs<Microsoft.Phone.Tasks.PhotoResult>;
            if (results != null)
                if (results.TaskResult == Microsoft.Phone.Tasks.TaskResult.OK)
                {
                    var source =new BitmapImage(new Uri(results.Result.OriginalFileName));
                    //source.s
                    //results.Result.OriginalFileName
                    //this.Target.GetType().GetProperty(TargetProperty).SetValue(this.Target, results.Result., null);
                }
        }

        protected override void Invoke(object parameter)
        {
            throw new NotImplementedException();
        }
    }*/
}
